package com.example.campuslink.commen.db.search

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

@Database(entities = [SearchTable::class], version = 1, exportSchema = true)
abstract class SearchData : RoomDatabase() {
    abstract fun searchDao(): SearchDao

    companion object {
        @Volatile
        private var INSTANCE: SearchData? = null

        fun getDatabase(context: Context): SearchData {
            return INSTANCE ?: synchronized(this) {
                val instance = Room.databaseBuilder(
                    context.applicationContext,
                    SearchData::class.java,
                    "search_dataBase"
                ).build()
                INSTANCE = instance
                instance
            }
        }
    }
}